﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DTO;
using System.Data.OleDb;
using System.Data;

namespace DAO
{
    public class DAO_Docgia
    {
        public DataTable LayDSDocGia()
        {
            string sql = "SELECT MaDocGia, TenDG, DiaChiDG,NgaySinhDG,SDTDG,NgayLapThe,MaNV,MaDocGiaBL from DocGia";
            return DataProvider.laydulieubang(sql, DataProvider.c);
        }
        public Boolean CapNhatBang_DAO(DataTable dt) {
            return DataProvider.CapNhatDataTable(dt, "docgia");
        }

        public int LayGiaTriLonNhatMaDG() {
            string sql = "select max(docgia.madocgia) from docgia";
            DataTable dt = DataProvider.laydulieubang(sql,DataProvider.c);
            return Convert.ToInt32(dt.Rows[0].ItemArray.GetValue(0));
        }
        public int XoaDG(string madg)
        {
            string sql = "Delete from Docgia where MaDG=" + madg;
            return DataProvider.Capnhatdl(sql);
        }
    }
}
